﻿using PageAdmin.Utils.ORM;
using System;
using System.Collections.Generic;

/// <summary>
/// 获取缓存的接口
/// </summary>
namespace PageAdmin.Utils.Common.BLL
{
    /// <summary>
    /// 获取缓存，如分类等常用的小数据表
    /// </summary>
    public interface ICacheQuery
    {
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="predicate"></param>
        /// <returns></returns>
        IEnumerable<T> GetList<T>(Func<T, bool> predicate = null) where T : class, new();

        /// <summary>
        /// 获取选项列表
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="predicate"></param>
        /// <returns></returns>
        IEnumerable<T> GetOptions<T>(Func<T, bool> predicate = null) where T :OptionsItem, new();

        /// <summary>
        /// 获取树形选项列表
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="predicate"></param>
        /// <returns></returns>
        IEnumerable<T> GetTreeOptions<T>(Func<T, bool> predicate = null) where T:MultipleLevelModelBase<T>, new();

        /// <summary>
        /// 清理缓存
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="predicate"></param>
        /// <returns></returns>
        void RemoveCache<T>() where T : class, new();
    }
}